<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var num=prompt('请输入用户人数');
        var sum=0;
        var average=0;
        for(var i=1;i<=num;i++){
            var score = prompt('请输入第'+i+'个用户的成绩');
            //从prompt取到的数据是字符串型
            sum=sum+parseFloat(score);
        }
        
        average = sum /num;
        alert('班级总成绩是:' + sum);
        alert('班级平均分是:'+ average);

    </script>
</head>
<body>
    
</body>
</html>